/* eslint-disable no-console */
const express = require("express");
const app = express();
const port = 7002;

app.listen(port, () => {
  console.log(`Mock serve listening at http://localhost:${port}`);
});

// 接口拼接，包含自定义接口和快速生成的接口，注意合并时的优先级，放在前面的优先级更高
const proxyInterceptorServers = require("./proxy-interceptor-servers.json");
const customServers = []; //require("./servers");

[...customServers, ...proxyInterceptorServers].forEach((server) => {
  const { method, url, data } = server;
  app[method](url, (_, res) => {
    const sendMsg = typeof data === "function" ? data() : data;
    res.json({ ...sendMsg, isMock: true });
  });
});
